'use strict'

const path = require('path')
function resolve(dir) {
  return path.join(__dirname, dir)
}

module.exports = {

  publicPath: './',
  // css 提取到一个独立的文件中
  outputDir: 'dist',
  assetsDir: 'static',
  // 保存时 es-line 检查
  lintOnSave: process.env.NODE_ENV === 'development',
  //  是否为生产环境构建生成 source map？
  productionSourceMap: false,
  css: {
    extract: true
  },
  configureWebpack: {
    name: 'name',
    // provide the app's title in webpack's name field, so that
    // it can be accessed in index.html to inject the correct title.
    resolve: {
      alias: {
        '@': resolve('src')
      }
    }
  },
  devServer: {
    open: true,
    overlay: {
      warnings: false,
      errors: true
    },
    proxy: {
      // ip 测试环境代理
      '/ip': {
        target: 'http://pv.sohu.com/cityjson?ie=utf-8',
        changeOrigin: true,
        pathRewrite: {
          '^/ip': ''
        }
      }
    }
  }
}

